package com.morningyet.bug.log4j2.application.controller;

import org.apache.logging.log4j.util.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 监控服务接口
 *
 * @author moringyet
 */
@RestController
@RequestMapping("monitor")
public class MonitorController {

    private static final Logger logger = LoggerFactory.getLogger(MonitorController.class);

    /**
     * 心跳检查
     *
     * 接口测试指令:
     * curl http://127.0.0.1:18080/monitor/beat -v
     */
    @GetMapping("beat")
    public ResponseEntity<String> beat() {
        logger.info("java.version: ${java:version}");
        logger.info("java.runtime: ${java:runtime}");
        logger.info("java.vm: ${java:vm}");
        logger.info("java.os: ${java:os}");
        logger.info("java.locale: ${java:locale}");
        logger.info("java.hw: ${java:hw}");
        return ResponseEntity.ok(Strings.EMPTY);
    }

}
